package rxt.huiyi.com.rxterfit.view.impl;

import android.content.Context;

import dagger.Module;
import dagger.Provides;
import rx.Observable;
import rxt.huiyi.com.rxterfit.ActivityScope;
import rxt.huiyi.com.rxterfit.RxJavaApplication;
import rxt.huiyi.com.rxterfit.constant.Constants;
import rxt.huiyi.com.rxterfit.entity.resultInfo.ContentSubscriberResultInfo;
import rxt.huiyi.com.rxterfit.view.IRespository;
import rxt.huiyi.com.rxterfit.view.URLService;

/**
 * Created by huiyi on 2017/4/24.
 */
@Module
@ActivityScope
public class URL1Respository implements IRespository {
    private Context context;

    public URL1Respository(Context context) {
        this.context = context;
    }

    @Provides
    @ActivityScope
    public URL1Respository provideRespository() {
        return new URL1Respository(context);
    }

    @Override
    public Observable<ContentSubscriberResultInfo> getCategory() {
        URLService urlService = RxJavaApplication.get(context).getRxAppComponent()
                .getRetrofit().create(URLService.class);
        return urlService.getCategoryResult(Constants.Key_MobAPI_Cook);
    }
}
